/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * <p>Project: javase - TreeMap1
 * <p>Powered by webrx On 2021-12-10 14:43:36
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class TreeMap1 {
    public static void main(String[] args) {
        HashMap<Integer, String> map = new HashMap<>();
        map.put(10, "java");
        map.put(5, "html");
        map.put(1, "javascript");
        System.out.println(map);
        System.out.println(map.keySet());
        System.out.println(map.values());

        TreeMap<Integer, String> tm = new TreeMap<>();
        tm.put(10, "java");
        tm.put(5, "html");
        tm.put(1, "javascript");
        System.out.println(tm);
        System.out.println(tm.keySet());
        System.out.println(tm.values());

        TreeMap<String, Integer> tt = new TreeMap<>();
        tt.put("hello", 1);
        tt.put("world", 2);
        tt.put("my", 3);
        tt.put("name", 4);
        tt.put("is", 5);
        tt.put("huangqiuping", 6);
        tt.put("i", 6);
        tt.put("am", 6);
        tt.put("a", 6);
        tt.put("developer", 6);
        System.out.println("添加元素后,TreeMap元素个数为：" + tt.size());
        System.out.println(tt);
        System.out.println(tt.keySet());
        System.out.println(tt.values());
    }
}
